#region Microsoft Public License
/*
 * (c) Copyright Chenjun Wu. http://utablesdk.codeplex.com
 * 
 * This source is subject to the Microsoft Public License (Ms-PL).
 * Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
 * All other rights reserved.
 */
#endregion

﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using UTable.Objects.Controls;
using UTable.Objects.Policies;

namespace UTable.Objects
{
    /// <summary>
    /// Interaction logic for BlankTabletop.xaml
    /// </summary>
    public partial class BlankTabletop : UObject
    {
        public BlankTabletop()
        {
            InitializeComponent();

            this.OperatingState = ObjectOperatingState.Editing;

            PhysicalLayoutPolicyParameter parameter = new PhysicalLayoutPolicyParameter(true, 0.98d, 0.9d);
            parameter.CollisionPolicy = new TabletopCollisionPolicy();
            this.LayoutPolicyParameter = parameter;
            this.LayoutPolicyType = typeof(PhysicalLayoutPolicy);
        }

        public override void OnMessageReceived(object message)
        {
            base.OnMessageReceived(message);
            if (message is String)
            {
                switch (message as String)
                {
                    case "SetBackgroundTranparent":
                        this.MyCanvas.Background = new SolidColorBrush(Colors.Transparent);
                        break;
                    case "SetBackgroundWhite":
                        this.MyCanvas.Background = new SolidColorBrush(Colors.White);
                        break;
                }
            }
        }

        private void Shutdown_Button_Pressed(object sender, ButtonEventArgs args)
        {
            UTableHelper.Shutdown(0);
        }
    }
}
